package cn.jathlon.wraper;

import gnu.trove.map.TIntObjectMap;
import gnu.trove.map.hash.TDoubleDoubleHashMap;
import gnu.trove.map.hash.TDoubleIntHashMap;
import gnu.trove.map.hash.TDoubleObjectHashMap;
import gnu.trove.map.hash.TIntDoubleHashMap;
import gnu.trove.map.hash.TIntIntHashMap;
import gnu.trove.map.hash.TIntObjectHashMap;
import gnu.trove.map.hash.TLongDoubleHashMap;
import gnu.trove.map.hash.TLongObjectHashMap;

/**
 * 原生类型作为键的Map工厂,根据代码提示返回的类型写相应的类型
 * @author chen
 * @param
 *
 */
public class PrimaryMapFactory {

	/**
	 * 原生类型int作为键,自定义对象作为value的map
	 * @param O
	 * @return
	 */
	public static <O> TIntObjectHashMap<O> getIntObjectMap(Class<? extends Object> O){
		return new TIntObjectHashMap<O>();
	}

	/**
	 * 原生类型double作为键,自定义对象作为value的map
	 * @param O
	 * @return
	 */
	public static <O> TDoubleObjectHashMap<O> getDoubleObjectMap(Class<? extends Object> O){
		return new TDoubleObjectHashMap<O>();
	}

	/**
	 * 原生类型long作为键,自定义对象作为value的map
	 * @param O
	 * @return
	 */
	public static <O> TLongObjectHashMap<O> getLongObjectMap(Class<? extends Object> O){
		return new TLongObjectHashMap<O>();
	}
	
	public static TIntIntHashMap getIntIntMap(){
		return new TIntIntHashMap();
	}
	
	public static TIntDoubleHashMap getIntDoubleMap(){
		return new TIntDoubleHashMap();
	}
	
	public static TDoubleDoubleHashMap getDoubleDoubleMap(){
		return new TDoubleDoubleHashMap();
	}
	
	public static TDoubleIntHashMap getDoubleIntMap(){
		return new TDoubleIntHashMap();
	}
	
	public static TLongDoubleHashMap getLongDoubleMap(){
		return new TLongDoubleHashMap();
	}
	
	public static void main(String[] args) {
		
		
		TIntObjectMap<P> t = PrimaryMapFactory.getIntObjectMap(P.class);
		t.put(23, new P());
		
	}
	
	
}

class P{
	int c;
	int v;
	
}
